// Meta table ajustments

local Meta = FindMetaTable("Player")

// Include

function Meta:IncludeClientsideFile(File)
	umsg.Start("SS.Lib.Include", self)
		umsg.String(File)
	umsg.End()
end

// PropSecure

function Meta:PropSecureIsPlayers(Entity)
	if (PropSecure) then
		if not (SS.Flags.PlayerHas(self, "PropSecure")) then
			if not (PropSecure.IsPlayers(self, Entity)) then
				return false
			end
		end
	end
	
	return true
end

// Play a sound

function Meta:PlaySound(Sound)
	umsg.Start("SS.GUI.PlaySound", Player)
		umsg.String(Sound)
	umsg.End()
end

// Trace

function Meta:TraceLine()
	local Trace = util.GetPlayerTrace(self)
	
	return util.TraceLine(Trace)
end

// Delete when killed

function Meta:DeleteOnDeath(Entity)
	TVAR.New(self, "DeleteOnDeath", {})
	
	local Index = Entity:EntIndex()
	
	TVAR.Request(self, "DeleteOnDeath")[Index] = Entity
end

// Player is ready

function Meta:IsReady()
	local Identity = self:SteamID()
	
	if (CVAR.Store[Identity]) then
		return true
	end
	
	return false
end

// Hide GUI

function Meta:HideGUI(ID, Type, Bool)
	TVAR.New(self, "HideGUI", {})
	TVAR.Request(self, "HideGUI")[Type] = TVAR.Request(self, "HideGUI")[Type] or {}
	TVAR.Request(self, "HideGUI")[Type][ID] = Bool
	
	local Number = 1
	
	if not (Bool) then
		Number = 0
	end
	
	if (Number == 1) then
		self:SetNetworkedInt("HideGUI: "..Type, 1)
	elseif (Number == 0) then
		local Found = false
		
		for K, V in pairs(TVAR.Request(self, "HideGUI")[Type]) do
			if (V) then
				self:SetNetworkedInt("HideGUI: "..Type, 1)
				
				Found = true
				
				break
			end
		end
		
		if not (Found) then
			self:SetNetworkedInt("HideGUI: "..Type, 0)
		end
	end
end

// Return chat value

function Meta:GetTextReturn()
	local Return = TVAR.Request(self, "TextReturnValue")
	
	return Return
end

// Set return chat value

function Meta:SetTextReturn(Return, Priority)
	local Backup = self:GetTextReturn()
	
	if (Backup) then
		if (Backup[2] < Priority) then
			return
		end
	end
	
	TVAR.Update(self, "TextReturnValue", {Return, Priority})
end